#pragma warning(disable:4996)
#pragma warning(disable:6031)

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

typedef struct SlistNode
{
	int data;
	struct SlistNode* next;
}SlistNode;

SlistNode* create(int a)
{
	SlistNode* newnode = (SlistNode*)malloc(sizeof(SlistNode));
	if (newnode == NULL)
	{
		perror("malloc");
		exit(-1);
	}
	newnode->data = a;
	newnode->next = NULL;
	return newnode;
}

void print(SlistNode* phead)
{
	SlistNode* ptr = phead;
	while (ptr != NULL)
	{
		printf("%d->", ptr->data);
		ptr = ptr->next;
	}
	printf("NULL\n");
}
void pusha(SlistNode** pphead, int a)
{
	SlistNode* newnode = create(a);
	if (*pphead == NULL)
	{
		*pphead = newnode;
	}
	else
	{
		SlistNode* ptr = *pphead;
		while (ptr->next != NULL)
		{
			ptr = ptr->next;
		}
		ptr->next = newnode;
	}
}

SlistNode* find(SlistNode* phead, int a)
{
	SlistNode* ptr = phead;
	while (ptr != NULL)
	{
		if (ptr->data == a)
		{
			return ptr;
		}
		ptr = ptr->next;
	}
	return NULL;
}

void pop(SlistNode** pphead,int a)
{
	SlistNode* pos = find(*pphead, a);
	assert(pos != NULL);
	if (pos = *pphead)
	{
		free(pos);
		*pphead = NULL;
	}
	else
	{
		SlistNode* prev = *pphead;
		while (prev->next != pos)
		{
			prev = prev->next;
		}
		prev->next = pos->next;
		free(pos);
	}
	pos = NULL;
}

int main()
{

	return 0;
}